<?php

namespace App\Http\Controllers;

use Illuminate\Foundation\Auth\Access\AuthorizesRequests;
use Illuminate\Foundation\Bus\DispatchesJobs;
use Illuminate\Foundation\Validation\ValidatesRequests;
use Illuminate\Routing\Controller as BaseController;

class Controller extends BaseController
{
    use AuthorizesRequests, DispatchesJobs, ValidatesRequests;

    public function Success($data = [], $code = 200, $message = 'success'): \Illuminate\Http\JsonResponse
    {
        return response()->json([
            'status' => $code,
            'message' => $message,
            'data' => $data
        ]);
    }

    public function Error($code = 400, $message = null): \Illuminate\Http\JsonResponse
    {
        return response()->json([
            'status' => $code,
            'message' => $message,
        ]);
    }
}
